package cn.easy;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

/**
 * @author 张澎_9970
 * @date 2021.12.13 下午 7:18 星期一
 * @desc:
 * @EnableEurekaClient, 可以不加
 * @EnableDiscoveryClient,相当于接口, 开启注册
 */
@SpringBootApplication
@MapperScan(basePackages = "cn.easy.dao")
@EnableEurekaClient
@EnableDiscoveryClient
public class UserProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(UserProviderApplication.class);
    }

    @Bean
    public Queue queue() {
        return new Queue("Boot_Topic_Queue_1");
    }

    @Bean
    public TopicExchange exchange() {
        return new TopicExchange("Boot_Topic_Exchange");
    }

    @Bean
    public Binding binding() {
        return BindingBuilder.bind(queue()).to(exchange()).with("order.*");
    }
}
